package common;

import com.concerneyes.CEApp;

import util.Preferences;

/**
 * 信息缓存类
 */
public class PreferUtil {
    private static CEApp context = CEApp.getInstance();
    private final static long UPGRADE_DURATION = 10 * 60 * 1000;

    private PreferUtil() {
    }

    // ----------UserId从服务器获取的用户唯一ID
    public static void saveUserId(String UserId) {
        Preferences.getPrefer(context).putString("UserId", UserId);
    }

    public static String getUserId() {
        return Preferences.getPrefer(context).getString("UserId", null);
    }

    // ----------RegistrationID极光推送的唯一设备id
    public static void cacheRegistrationID(String RegistrationID) {
        Preferences.getPrefer(context).putString("RegistrationID", RegistrationID);
    }

    public static String getRegistrationID() {
        return Preferences.getPrefer(context).getString("RegistrationID", null);
    }

    // ----------版本号
    public static void saveVersion(String version) {
        Preferences.getPrefer(context).putString("version", version);
    }

    public static String getVersion() {
        return Preferences.getPrefer(context).getString("version", null);
    }

    // ----------保存修改后的头像Url
    public static void saveHeaderImgUrl(String HeaderImgUrl) {
        Preferences.getPrefer(context).putString("HeaderImgUrl", HeaderImgUrl);
    }

    public static String getHeaderImgUrl() {
        return Preferences.getPrefer(context).getString("HeaderImgUrl", null);
    }

    // ----------保存修改后的头像Url
    public static void saveIsFirstEdit(boolean IsFirstEdit) {
        Preferences.getPrefer(context).putBoolean("IsFirstEdit", IsFirstEdit);
    }

    public static boolean getIsFirstEdit() {
        return Preferences.getPrefer(context).getBoolean("IsFirstEdit", true);
    }

}
